/*******************************************************************************
 * Copyright (c) 2009 Markus Knittig and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Markus Knittig - initial API and implementation
 *******************************************************************************/
package com.googlecode.mylyn.core.util;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;


public class GoogleCodeUtilsTest {

    @Test
    public void testHasNonAsciiCharactersOnlyAscii() {
        assertFalse(GoogleCodeUtils.hasNonAsciiCharacters("_abc-123"));
    }

    @Test
    public void testHasNonAsciiCharactersNonAscii() {
        assertTrue(GoogleCodeUtils.hasNonAsciiCharacters("abcäöü"));
    }

    @Test
    public void testGetRepositoryFeedUrl() {
        String repositoryFeedUrl = GoogleCodeUtils.getRepositoryFeedUrl("http://code.google.com/p/googlecode-mylyn-connector/");
        assertEquals("http://code.google.com/feeds/issues/p/googlecode-mylyn-connector", repositoryFeedUrl);
    }
    
    @Test
    public void testGetRepositoryFeedUrlAffiliate() {
        String repositoryFeedUrl = GoogleCodeUtils.getRepositoryFeedUrl("http://code.google.com/a/eclipselabs.org/p/workspacemechanic/");
        assertEquals("http://code.google.com/a/eclipselabs.org/feeds/issues/p/workspacemechanic", repositoryFeedUrl);
    }

}
